SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[empregoArAtuacaoInsert]') AND type in (N'P', N'PC'))
BEGIN
EXEC dbo.sp_executesql @statement = N'

CREATE PROCEDURE spEmpregoArAtuacaoInsert
(
	@NomeArAtuacao Varchar(100)	
)
AS

INSERT empregoArAtuacao 
(
	
	eat_nome
) 
	VALUES 
(
	
	@NomeArAtuacao
)
' 
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[empregoArAtuacaoSelect]') AND type in (N'P', N'PC'))
BEGIN
EXEC dbo.sp_executesql @statement = N'
CREATE PROCEDURE spEmpregoArAtuacaoSelect
(
	@IdArAtuacao Int
)
AS
SELECT
	eat_id,	
	eat_nome	
FROM
	empregoareaatuacao
WHERE 
	eat_id = @IdArAtuacao
' 
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[empregoArAtuacaoUpdate]') AND type in (N'P', N'PC'))
BEGIN
EXEC dbo.sp_executesql @statement = N'
CREATE PROCEDURE spEmpregoArAtuacaoUpdate
(
	@IdArAtuacao Int,
	@NomeArAtuacao Varchar(100)	
)
AS
UPDATE empregoareaatuacao SET
	eat_nome = @NomeArAtuacao
	
WHERE eat_id = @IdArAtuacao
' 
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[empregoArAtuacaoSelectAll]') AND type in (N'P', N'PC'))
BEGIN
EXEC dbo.sp_executesql @statement = N'
CREATE PROCEDURE spEmpregoArAtuacaoSelectAll
	
AS   SELECT eat_id, eat_nome FROM  dbo.empregoareaatuacao
ORDER BY eat_nome
	SET NOCOUNT ON 
	RETURN
' 
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[empregoArAtuacaoDelete]') AND type in (N'P', N'PC'))
BEGIN
EXEC dbo.sp_executesql @statement = N'
CREATE PROCEDURE spEmpregoArAtuacaoDelete
(
	@IdArAtuacao Int
)
AS
DELETE 
	empregoareaatuacao
WHERE 
	eat_id = @IdArAtuacao 
' 
END
